package com.fuchen.academic.listener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

import org.apache.log4j.Logger;

@WebListener
public class SystemContextListener implements ServletContextListener {

	private final Logger log = Logger.getLogger(getClass());
	
	public void contextDestroyed(ServletContextEvent event) {
		
		log.error("系统开始停止...");
		
	}

	public void contextInitialized(ServletContextEvent event) {

		log.error("系统开始启动...");
		
		event.getServletContext().setAttribute("webRoot", event.getServletContext().getContextPath());
		
		log.debug("系统路径:"+event.getServletContext().getContextPath());
		
		log.debug("系统名称:"+event.getServletContext().getInitParameter("contextName"));
		
		event.getServletContext().setAttribute("contextName", event.getServletContext().getInitParameter("contextName"));
		
	}

}
